# -*- coding: utf-8 -*-
"""
main
2025/9/8
@author: zhangzida
"""
import logging

def logger(name='utils.py'):
    logger = logging.getLogger(name)
    if not logger.handlers:
        fmt = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
        file_hd = logging.FileHandler('log.log', encoding='utf-8')
        file_hd.setFormatter(fmt)
        logger.addHandler(file_hd)

        con = logging.StreamHandler()
        con.setFormatter(fmt)
        logger.addHandler(con)

        logger.setLevel(logging.DEBUG)
    return logger